﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Navigation;
using System.IO;

namespace Bu
{
	/// <summary>
	/// Interaction logic for Main.xaml
	/// </summary>
	public partial class Main : Window
	{
        private string AppTitle;
		public Main()
		{
			this.InitializeComponent();
            this.AppTitle = Title;
			// Insert code required on object creation below this point.
		}

        private void OnExit(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }

        private void LoadQuestion(UserControl question)
        {
            Canvas cnvQuestions = this.LayoutRoot.FindName("cnvQuestions") as Canvas;
            if (cnvQuestions != null)
            {
                cnvQuestions.Children.Clear();
                cnvQuestions.Children.Add(question);
                this.Title = this.AppTitle + " [" + question.Name + "]";
            }
        }

        private void btnQ1_Click(object sender, RoutedEventArgs e)
        {
            LoadQuestion(new Question1());
        }

        private void btnQ2_Click(object sender, RoutedEventArgs e)
        {
            LoadQuestion(new Question2());
        }

        private void btnQ3_Click(object sender, RoutedEventArgs e)
        {
            LoadQuestion(new Question3());
        }

        private void btnQ4_Click(object sender, RoutedEventArgs e)
        {
            LoadQuestion(new Question4());
        }

        private void btnQ5_Click(object sender, RoutedEventArgs e)
        {
            LoadQuestion(new Question5());
        }

        private void btnQ6_Click(object sender, RoutedEventArgs e)
        {
            LoadQuestion(new Question6());
        }

        private void btnQ7_Click(object sender, RoutedEventArgs e)
        {
            LoadQuestion(new Question7());
        }

        private void btnExit_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
	}
}